<template>
<div>
    <div class="logo"><img src="https://assets.maizuo.com/h5/mz-auth/public/app/img/logo.19ca0be.png" alt=""></div>
    <div class="body">
        <div class="tel"><input type="text" placeholder="手机号" v-model="tel"><span @click="getCode">获取验证码</span></div>
         <div class="code"><input type="text" placeholder="验证码" v-model="code"></div>
         <p @click="login">登录</p>
    </div>
</div>
</template>
<script>
import {sendCode,loginUser} from '@/api/login.js'
export default {
    data(){
        return{
            tel:'',
            code:''

        }
    },
    methods:{
        getCode(){
        sendCode(this.tel).then(res=>{
            console.log(res)
        })

        },
        login(){
            // loginUser(this.code,this.tel).then(res=>{
            //     console.log(res)
            // })
        if(this.code==333555){
            var info={msg:'登录成功',tel:this.tel}
            localStorage.setItem('status',JSON.stringify(info))
            this.$store.commit('setStatus')
            // this.$router.push('/purchase/:'+this.$route.query.id)
            this.$router.go(-1)
            console.log(this.$store.state.status,111111111111)
        }

        }
    }
}
</script>

<style lang="scss" scoped>
.logo{
    height:1.2rem;
    margin:1.6rem 0 0.8rem 0;
    text-align: center;
    img{
        height:1.2rem;
        width:1.2rem;
    }
}

.body{
    height:4.5rem;
    padding:0 0.5rem;
    box-sizing: border-box;
    .tel,.code{
        height:1.1rem;
        padding:0.4rem 0;
        box-sizing: border-box;
        border-bottom: 0.01rem solid lightgray;
        input{
            height:0.2rem;
            float:left;
            font-size: 0.15rem;
            color:#191a1b;
        }
        span{
            font-size: 0.15rem;
            float:right;
        }
    }
            p{
            margin-top:1.3rem;
                    height:1.1rem;
             line-height: 1.1rem;
             text-align: center;
             color:white;
            font-size: 0.3rem;
            background-color: #ff5f16;



        }

}

</style>